package com.mxpio.erp.common.purchase.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mxpio.erp.common.jpa.model.BizOrder;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.User;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_PURC_PO")
@Schema(description="采购订单")
public class PurchaseOrder extends BizOrder {

	private static final long serialVersionUID = 1L;

	@Column(name = "ORDER_TYPE_")
	@Schema(description = "单据类型")
	@Dict(dicCode="ERP_PURC_ORDER_TYPE")
	private String orderType;

	@Column(name = "CONTRACT_NO_")
	@Schema(description = "合同编号")
	private String contractNo;

	@Schema(description = "供应商名称")
	@Column(name = "PN_NAME_")
	private String pnName;

	@Schema(description = "供应商简称")
	@Column(name = "PN_ABBR_")
	private String pnAbbr;

	@Column(name = "BIZ_MAN_")
	@Schema(description = "业务员")
	@Dict(dicCode = "username",dicEntity = User.class,dicText = "nickname")
	private String bizMan ;

	@Column(name = "MEMO_")
	@Schema(description = "备注")
	private String memo;
	
	@Transient
	private List<PurchaseOrderLine> purchaseOrderLine;
	
	@Transient
	private Supply supply;
	
	@Override
	public String initTypeCode() {
		return "PO1";
	}
}
